package com.zzu.service;

import com.zzu.dao.IStudentDao;
import com.zzu.dao.ITeacherDao;
import com.zzu.model.Course;
import com.zzu.model.Student;
import com.zzu.model.Teacher;
import com.zzu.model.TeacherGrade;
import com.zzu.utils.MyBatisUtils;
import org.apache.ibatis.session.SqlSession;
import org.junit.jupiter.api.Test;

import java.util.List;

public class TeacherService {

    //获得教师账号
    public Teacher findTeacher(String id, String password){
        SqlSession sqlSession = MyBatisUtils.getSqlSession();
        ITeacherDao teacherDao = sqlSession.getMapper(ITeacherDao.class);
        return teacherDao.findTeacher(id,password);
    }

    //根据id查询教师信息
    public Teacher findTeacherById(String tId)
    {
        SqlSession sqlSession = MyBatisUtils.getSqlSession();
        ITeacherDao mapper = sqlSession.getMapper(ITeacherDao.class);
        return mapper.findTeacherById(tId);
    }

    //查询学生成绩
    public List<TeacherGrade> findGrades(String id)
    {
        SqlSession sqlSession = MyBatisUtils.getSqlSession();
        ITeacherDao mapper = sqlSession.getMapper(ITeacherDao.class);
        return mapper.findGrades(id);
    }



    @Test
    public void test()
    {
        System.out.println(findGrades("20160000"));
    }

}
